package com.hc.controller;

import com.hc.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.annotation.Target;

/**
 * @author hs
 * @date 2021/05/06
 */
@RestController
public class HelloController {

    @GetMapping("/hello")
    public String hello(){
        return "helloSwagger!";
    }

    /**
     * 只要我们的接口返回值有实体类 那么这个实体类就会被swagger扫描到
     * @return 。
     */
    @PostMapping("/user")
    @ApiOperation("返回一个User")
    public User getUser(){
        return new User();
    }

    @PostMapping("/user2")
    @ApiOperation("返回第二个实体类")
    public User getUser2(@ApiParam("用户") User user){
        return user;
    }
}
